// Package str 字符串辅助方法
package str

import (
	"strings"

	"github.com/gertd/go-pluralize"
	"github.com/iancoleman/strcase"
)

// Plural 复数处理 eg: user => users
func Plural(word string) string {
	return pluralize.NewClient().Plural(word)
}

// Singular 单数处理 eg: users => user
func Singular(word string) string {
	return pluralize.NewClient().Singular(word)
}

// Snake 蛇形命名 eg: UserName => user_name
func Snake(word string) string {
	return strcase.ToSnake(word)
}

// Camel 驼峰命名 eg: user_name => UserName
func Camel(word string) string {
	return strcase.ToCamel(word)
}

// LowerCamel 小驼峰命名 eg: UserName => userName
func LowerCamel(word string) string {
	return strcase.ToLowerCamel(word)
}

func ReplaceAll(s, old, new string) string {
	return strings.ReplaceAll(s, old, new)
}
